package com.zhongyu.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhongyu.mapper.CangKuMapper;
import com.zhongyu.mapper.StoreMapper;
import com.zhongyu.pojo.Store;
import com.zhongyu.service.StoreService;
import com.zhongyu.vo.PageResult;
import com.zhongyu.vo.StoreVo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service("storeService")
public class StoreServiceImpl  extends ServiceImpl<StoreMapper, Store> implements StoreService {

    @Resource
    private CangKuMapper cangKuMapper;
    @Override
    public PageResult searchAll(Integer pageNo, Integer pageSize, StoreVo storeVo) {
        LambdaQueryWrapper<Store> wrapper= Wrappers.<Store>lambdaQuery();
        Page page=new Page(pageNo,pageSize);
        List<Store> list=cangKuMapper.findAll(page,wrapper);
        return new PageResult(list,page.getTotal());
    }
    @Override
    public List<Store> searchAll() {
        return baseMapper.selectList(null);
    }
    @Override
    public void add(Store store) {
        cangKuMapper.insert(store);
    }
}
